Fixing hangs with GtkScrolledWindow
authorTristan Van Berkom <tristan.van.berkom@gmail.com>
Thu, 18 Nov 2010 15:53:13 +0000 (00:53 +0900)
committerTristan Van Berkom <tristan.van.berkom@gmail.com>
Thu, 18 Nov 2010 15:53:13 +0000 (00:53 +0900)
Now gtk_widget_size_allocate() unsets the resize_needed flags
before returning, essentially this means that any widget that
has a queued resize and is allocated before resize time, including
queued resizes from inside a size_allocate() method will be
cancelled.

gtk/gtkwidget.c

index 4ced3d99ea38b1747e86f9ecd814997b1758e8a7..1c3955b75db4f4cbf833f0e7c142a12bb038cf0c 100644 (file)
@@ -4386,6 +4386,11 @@ gtk_widget_queue_draw (GtkWidget *widget)
  * be called when a widget for some reason has a new size request.
  * For example, when you change the text in a #GtkLabel, #GtkLabel
  * queues a resize to ensure there's enough space for the new text.
+ *
+ * <note><para>You cannot call gtk_widget_queue_resize() on a widget
+ * from inside it's implementation of the GtkWidgetClass::size_allocate 
+ * virtual method. Calls to gtk_widget_queue_resize() from inside
+ * GtkWidgetClass::size_allocate will be silently ignored.</para></note>
  **/
 void
 gtk_widget_queue_resize (GtkWidget *widget)
@@ -4671,6 +4676,11 @@ gtk_widget_size_allocate (GtkWidget      *widget,
 
   g_signal_emit (widget, widget_signals[SIZE_ALLOCATE], 0, &real_allocation);
 
+  /* Size allocation is god... after consulting god, no further requests or allocations are needed */
+  priv->width_request_needed  = FALSE;
+  priv->height_request_needed = FALSE;
+  priv->alloc_needed          = FALSE;
+
   if (gtk_widget_get_mapped (widget))
     {
       if (!gtk_widget_get_has_window (widget) && priv->redraw_on_alloc && position_changed)